<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Os1: /home/alejandro/Desarrollo eclipse/os1/Thirdparty/DBoW2/DUtils/Timestamp.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Os1
   &#160;<span id="projectnumber">1</span>
   </div>
   <div id="projectbrief">OrbSlam2 documentado y modificado</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,'Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_timestamp_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Timestamp.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_timestamp_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * File: Timestamp.h</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Author: Dorian Galvez-Lopez</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Date: March 2009</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Description: timestamping functions</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * License: see the LICENSE.txt file</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef __D_TIMESTAMP__</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define __D_TIMESTAMP__</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespacestd.html">std</a>;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_d_utils.html">DUtils</a> {</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html">   19</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;{</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8">   24</a></span>&#160;  <span class="keyword">enum</span> <a class="code" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8">tOptions</a></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;  {</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8a786d448832975701b79c18f24f1d52c9">   26</a></span>&#160;    NONE = 0,</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8a2b8a10e2984fac4c048daa8af7ceee5e">   27</a></span>&#160;    CURRENT_TIME = 0x1,</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8a8bb8c1ae23bdd2bbfb578fc27db83d80">   28</a></span>&#160;    ZERO = 0x2</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  };</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;  </div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  </div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a>(<a class="code" href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8">Timestamp::tOptions</a> option = NONE);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    </div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  <span class="keywordtype">bool</span> empty() <span class="keyword">const</span>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordtype">void</span> setToCurrentTime();</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a439bcff577f3ae30e8918897ecb33e76">   61</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_d_utils_1_1_timestamp.html#a439bcff577f3ae30e8918897ecb33e76">setTime</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> secs, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> usecs){</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        m_secs = secs;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        m_usecs = usecs;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    }</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    </div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a15e5c1a751a3faef596437a69d4c3d88">   71</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_d_utils_1_1_timestamp.html#a15e5c1a751a3faef596437a69d4c3d88">getTime</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> &amp;secs, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> &amp;usecs)<span class="keyword"> const</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;      secs = m_secs;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;      usecs = m_usecs;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    }</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordtype">void</span> setTime(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;stime);</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    </div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keywordtype">void</span> setTime(<span class="keywordtype">double</span> s);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    </div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">double</span> getFloatTime() <span class="keyword">const</span>;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordtype">string</span> getStringTime() <span class="keyword">const</span>;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordtype">double</span> operator- (<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> plus(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> s, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> us) <span class="keyword">const</span>;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> minus(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> s, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> us) <span class="keyword">const</span>;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;  <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a>&amp; operator+= (<span class="keywordtype">double</span> s);</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  </div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a>&amp; operator-= (<span class="keywordtype">double</span> s);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> operator+ (<span class="keywordtype">double</span> s) <span class="keyword">const</span>;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> operator- (<span class="keywordtype">double</span> s) <span class="keyword">const</span>;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="keywordtype">bool</span> operator&gt; (<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="keywordtype">bool</span> operator&gt;= (<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <span class="keywordtype">bool</span> operator== (<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespaceg2o.html#a2a6eaf50f7bfb542915d123feee52f6a">operator&lt; </a>(<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    <span class="keywordtype">bool</span> operator&lt;= (<span class="keyword">const</span> <a class="code" href="class_d_utils_1_1_timestamp.html">Timestamp</a> &amp;t) <span class="keyword">const</span>;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;  <span class="keywordtype">string</span> Format(<span class="keywordtype">bool</span> machine_friendly = <span class="keyword">false</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">string</span> Format(<span class="keywordtype">double</span> s);</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    </div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#a88b8dff916bb011ef4142ca5cc655425">  196</a></span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="class_d_utils_1_1_timestamp.html#a88b8dff916bb011ef4142ca5cc655425">m_secs</a>;   <span class="comment">// seconds</span></div><div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="class_d_utils_1_1_timestamp.html#afb8947a2cf3b04919f782f4490ca0935">  198</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="class_d_utils_1_1_timestamp.html#afb8947a2cf3b04919f782f4490ca0935">m_usecs</a>;  <span class="comment">// microseconds</span></div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;};</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;}</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;</div><div class="ttc" id="class_d_utils_1_1_timestamp_html_a5a8a3cb7f9e0f73bf11fce42688b06c8"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html#a5a8a3cb7f9e0f73bf11fce42688b06c8">DUtils::Timestamp::tOptions</a></div><div class="ttdeci">tOptions</div><div class="ttdoc">Options to initiate a timestamp. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:24</div></div>
<div class="ttc" id="class_d_utils_1_1_timestamp_html_a439bcff577f3ae30e8918897ecb33e76"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html#a439bcff577f3ae30e8918897ecb33e76">DUtils::Timestamp::setTime</a></div><div class="ttdeci">void setTime(unsigned long secs, unsigned long usecs)</div><div class="ttdoc">Sets the timestamp from seconds and microseconds. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:61</div></div>
<div class="ttc" id="namespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div><div class="ttdoc">This file is part of ORB-SLAM2. </div></div>
<div class="ttc" id="class_d_utils_1_1_timestamp_html_a15e5c1a751a3faef596437a69d4c3d88"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html#a15e5c1a751a3faef596437a69d4c3d88">DUtils::Timestamp::getTime</a></div><div class="ttdeci">void getTime(unsigned long &amp;secs, unsigned long &amp;usecs) const</div><div class="ttdoc">Returns the timestamp in seconds and microseconds. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:71</div></div>
<div class="ttc" id="class_d_utils_1_1_timestamp_html"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html">DUtils::Timestamp</a></div><div class="ttdoc">Timestamp. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:19</div></div>
<div class="ttc" id="namespaceg2o_html_a2a6eaf50f7bfb542915d123feee52f6a"><div class="ttname"><a href="namespaceg2o.html#a2a6eaf50f7bfb542915d123feee52f6a">g2o::operator&lt;</a></div><div class="ttdeci">bool operator&lt;(const HyperDijkstra::AdjacencyMapEntry &amp;a, const HyperDijkstra::AdjacencyMapEntry &amp;b)</div><div class="ttdef"><b>Definition:</b> hyper_dijkstra.cpp:80</div></div>
<div class="ttc" id="class_d_utils_1_1_timestamp_html_a88b8dff916bb011ef4142ca5cc655425"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html#a88b8dff916bb011ef4142ca5cc655425">DUtils::Timestamp::m_secs</a></div><div class="ttdeci">unsigned long m_secs</div><div class="ttdoc">Seconds. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:196</div></div>
<div class="ttc" id="namespace_d_utils_html"><div class="ttname"><a href="namespace_d_utils.html">DUtils</a></div><div class="ttdef"><b>Definition:</b> Random.h:18</div></div>
<div class="ttc" id="class_d_utils_1_1_timestamp_html_afb8947a2cf3b04919f782f4490ca0935"><div class="ttname"><a href="class_d_utils_1_1_timestamp.html#afb8947a2cf3b04919f782f4490ca0935">DUtils::Timestamp::m_usecs</a></div><div class="ttdeci">unsigned long m_usecs</div><div class="ttdoc">Microseconds. </div><div class="ttdef"><b>Definition:</b> Timestamp.h:198</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_08235c883c2d11e586a63e6645937db5.html">Thirdparty</a></li><li class="navelem"><a class="el" href="dir_d1a1b6b9a428c17d660585cf3877a970.html">DBoW2</a></li><li class="navelem"><a class="el" href="dir_e9a4af7428d78393e998361510b02141.html">DUtils</a></li><li class="navelem"><a class="el" href="_timestamp_8h.html">Timestamp.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
